package com.ghy.entity;

import com.mybatisflex.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 课程表 实体类。
 *
 * @author ghy
 * @since 2024-12-22
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "course", schema = "ml_cms")
public class Course implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @Id(keyType = KeyType.Auto)
    private Long id;

    /**
     * 标题
     */
    private String title;

    /**
     * 作者
     */
    private String author;

    /**
     * 课程类别ID
     */
    private Long fkCategoryId;

    /**
     * 摘要图地址
     */
    private String summary;

    /**
     * 封面图地址
     */
    private String cover;

    /**
     * 单价(元)
     */
    private Double price;

    /**
     * 序号
     */
    private Long idx;

    /**
     * 描述
     */
    private String info;

    /**
     * 数据版本
     */
    @Column(version = true)
    private Long version;

    /**
     * 逻辑删除,0未删除,1已删除
     */
    @Column(isLogicDelete = true)
    private Integer deleted;

    /**
     * 创建时间
     */
    private LocalDateTime created;

    /**
     * 修改时间
     */
    private LocalDateTime updated;

    /**课程[1]：季次[N]*/
    @RelationOneToMany(selfField = "id", targetField = "fkCourseId")
    private List<Season> seasons;

    /**课程[N]：类目[1]*/
    @RelationManyToOne(selfField = "fkCategoryId", targetField = "id")
    private Category category;

}
